Add support for Python 3.15#2183
Conversation
There was a problem hiding this comment.
Pull request overview
Adds CI coverage and packaging metadata updates to recognize and exercise Python 3.15 (including free-threaded builds) during the beta period, aligning GitPython’s declared support with current upstream Python testing guidance.
Changes:
- Add Trove classifiers for Python 3.13–3.15 in
setup.py. - Extend the GitHub Actions test matrix to run on Python 3.15 / 3.15t and stop testing 3.13t.
- Mark 3.15 / 3.15t as “experimental” to enable
actions/setup-pythonpre-release installs viaallow-prereleases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| setup.py | Adds Trove classifiers for Python 3.13–3.15 to reflect supported versions. |
| .github/workflows/pythonpackage.yml | Updates CI matrix to add 3.15/3.15t and remove 3.13t, enabling prereleases for 3.15 via allow-prereleases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| python-version: "3.13" # FIXME: Fix and enable Python 3.13 and 3.14 on Windows (#1955). | ||
| - os-type: windows | ||
| python-version: "3.13t" | ||
| python-version: "3.13" # FIXME: Fix and enable Python 3.13-3.15 on Windows (#1955). |
There was a problem hiding this comment.
@EliahKagan I wonder if this comment is still valid? We have been running on Windows for a while, even though maybe not with all tests enabled.
My hope would be that with the improvements to deterministic destruction, more tests can work as filehandles will be closed more reliably.
There was a problem hiding this comment.
The semantics of os.path.isabs changed in Python 3.13 on Windows. This had caused the behavior of code like index.remove('/only/looks/absolute') to differ, such that it was not immediately obvious what the behavior should be. It caused a test to fail, but that could not reasonably be fixed without figuring out what ought to actually happen.
I think it's very likely that GitPython has or had bugs that would make this behavior wrong both before and after the chage, though I am not sure. Really, all uses of os.path.isabs, including when spelling it osp.isabs after import os.path as osp, should be audited, and also compared to the uses of the is_absolute method of Path, which I believe had always regarded paths beginning with a single separator as non-absolute on Windows.
I had meant to fix this in #1955 but that ended up stalling due to my inability to put much time into GitPython at the time, and I very much agree with its closure--I should've myself closed it much earlier, to make clearer to others that they should feel welcome to contribute tests and fixes.
To be clear, paths on Windows that start with a single / or \ are indeed not absolute, because they are relative to the current drive. (A path that starts with a single / on a Unix-like system is of course absolute.) However, it may be that existing code in GitPython also assumes that, even on Windows, all relative paths are relative to a specific directory, rather than unconditionally specifying a root directory but relative to the current drive. So the way GitPython handles relative and absolute paths in general, including but not limited to when it uses os.path.isabs or pathlib.Path.is_absolute or related functions, should be examined in case there are bugs.
I suspect that, these days, all of this can be examined, and any findings rechecked and remediated, fairly efficiently.
The Python 3.15 beta is out. 🚀
The 3.15 release manager (👋 hi, that's me!) said:
Also declare support for 3.13-3.15 with Trove classifiers.
And includes a suggestion: stop testing free-threaded 3.13t. It was experimental, 3.14t and up are properly supported and have better performance, and many other projects are stopping testing 3.13t, such as cibuildwheel and Pillow.